package com.ztf.annotation;

import com.ztf.annotation.anno.ProgressRequired;
import com.ztf.annotation.entity.Person;

import java.lang.reflect.Field;

public class TestPerson {

    public static void main(String[] args) {
        Person person = new Person("1","张三","1","26","123132132");


        try {
            Field[] fields = Person.class.getDeclaredFields();
            System.out.println("aaa="+fields.length);
            for(Field field:fields){
                System.out.println("======"+field.isAnnotationPresent(ProgressRequired.class));
            }
            Field f = person.getClass().getDeclaredField("name");
            ProgressRequired pro = f.getAnnotation(ProgressRequired.class);
           String citycode =  pro.cityCode();
            System.out.println("citycode="+citycode);
            Field f1 = person.getClass().getDeclaredField("sex");
            ProgressRequired pro3 = f1.getAnnotation(ProgressRequired.class);
            String[] request =  pro3.request();
            System.out.println("====="+request[0]);
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }

    }
}
